/*
 *  scoreBoard - PlayerHead.h
 *  Copyright 2011 W. Reckman. All rights reserved.
 */
#ifndef PLAYER_HEAD_H
#define PLAYER_HEAD_H

#include "BoardModel.h"

class Settings;


class PlayerHead {
public:
	static const float MAX_BITE_ANGLE;
	
	PlayerHead( ScoreBoardApp& appRef_ );
	~PlayerHead();
	
	void setup( const BoardModel::PlayerInfo& info_, int gameNumber_ );
	void update();
	void drawAtPos( int x_, int y_, float animPos_ = 0.0f, float scale_ = 1.0f ) const;
	void draw( bool drawAsWinner_ = false, float animPos_ = 0.0f ) const;
	
	int getGameNumber() const;
	const BoardModel::PlayerInfo& getInfo() const;
	
	void setDrawingEnabled( bool enable_ );
	void setPosition( float x_, float y_ );
	void setXRange( float minX_, float maxX_ );
	void setYRange( float minY_, float maxY_ );
	void setMoveSpeedFactor( float factor_ );
	
private:
	Settings& s;
	ScoreBoardApp& appRef;
	
	float baseMoveSpeed;
	float moveSpeedVariation;
	float baseBiteSpeed;
	float moveSpeedFactor;
	
	BoardModel::PlayerInfo info;
	int gameNumber;
	
	float minX, maxX, minY, maxY;
	
	bool drawingEnabled;
	ofPoint pos;
	bool xDir, yDir; //true is forward
	ofImage* topImage;
	ofImage* bottomImage;
	bool drawMirrored;
	float drawRotated;
	
	float lastGameTime;
	bool biteAngleIncreasing;
	float biteAngle;
	
	void draw( int x_, int y_, float rotation_, float scale_ = 1.0f ) const;
};

#endif /* ! PLAYER_HEAD_H */
